const app = getApp();
import { request } from '../../utils/request';
import config from '../../utils/config'
Page({
    data: {
        custom: wx.getMenuButtonBoundingClientRect(),
        picUrl: config.picUrl,
        userInfo: {},
        page:1,
        last_page:1,
        endHide:true,
        list:[]
    },
    onLoad(options) {
        wx.hideShareMenu()
        var timer = setInterval(() => {
            var userInfo = wx.getStorageSync('userInfo')
            if (userInfo) {
                this.setData({ userInfo })
                this.getPayList()
                clearInterval(timer)
            }
        }, 500)
    },
    getPayList(){
        request({url:"/miniprogram/user/getMemberPayList",data:{user_id:this.data.userInfo.id,page:this.data.page}}).then(res=>{
            this.setData({
                list:res.data,
                last_page:res.last_page
            })
        })
    },
    onReachBottom: function(e) {
        if(this.data.page >= this.data.last_page){
            this.setData({endHide:false})
            return false;
        }
        this.setData({page:this.data.page+1})
        this.getPayList()
    },
})